package com.www.ve.controller;

import com.www.ve.dto.SysLoginDTO;
import com.www.ve.service.SysUserService;
import com.www.ve.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 类描述
 *
 * @author XiaoJie
 * @date 2025/6/27 11:45
 */
@Tag(name = "系统")
@RestController
@RequestMapping("sys/user")
@Slf4j
public class SystemController {
    @Resource
    private SysUserService sysUserService;

    @PostMapping("/login")
    @Operation(summary = "系统登录", description = "用户使用账号密码进行登录操作")
    public Result<Boolean> login (@RequestBody SysLoginDTO login) {
        log.info("用户登录------>：{}",login);
        return Result.ok(sysUserService.login(login));
    }

    @PostMapping("/register")
    @Operation(summary = "注册")
    public Result<Boolean> register (@RequestBody SysLoginDTO register) {
        log.info("用户登录------>：{}",register);
        return Result.ok(sysUserService.register(register));
    }
}
